<?php

$url = $this->context->id.'/'.$this->context->action->id;
?>
<?= \common\widgets\Asset::widget(['type'=>['summernote']])?>
    <style>
        legend {
            width: auto !important;
            border-style: none !important;
        }
        .layui-tab-brief>.layui-tab-title .layui-this a {
            color: #009688 !important;
        }
    </style>
    <div class="ui-layout-center ui-layout-pane">
        <div class="container-div">
            <div class="row">
                <div class="col-sm-12 search-collapse" style="display: block">
                    <div class="layui-card-body">
                        <div class="layui-collapse like-layui-collapse" lay-accordion=""
                             style="border:1px dashed #c4c4c4">
                            <div class="layui-colla-item">
                                <h2 class="layui-colla-title like-layui-colla-title" style="background-color: #fff">操作提示<i
                                        class="layui-icon layui-colla-icon"></i></h2>
                                <div class="layui-colla-content layui-show">
                                    <p>*具体请仔细看配置说明；</p>
                                </div>
                            </div>
                        </div>
                    </div>
                    <form class="form-horizontal" id="form-config-site-site">
                        <div class="form-group">
                            <label class="col-sm-2 control-label is-required">文件存储位置：</label>
                            <div class="col-sm-9">
                                <?= \common\widgets\FormInput::widget(['name'=>'radio','extend'=>['value'=>$info['current_way'],'name'=>'current_way','required'=>1,'data'=>$uploadWay]])?>
                            </div>
                        </div>
                        <div class="form-group parame parame_qiniu">
                            <label class="col-sm-2 control-label is-required">ak：</label>
                            <div class="col-sm-9">
                                <input type="text" name="qiniu[ak]" value="<?=$info['qiniu']['ak']??''?>" class="form-control" autocomplete="off" required>
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 查看方式 个人中心=》密钥管理=>AK</span>
                            </div>
                        </div>
                        <div class="form-group parame parame_qiniu">
                            <label class="col-sm-2 control-label is-required">sk：</label>
                            <div class="col-sm-9">
                                <input type="text" name="qiniu[sk]" value="<?=$info['qiniu']['sk']??''?>" class="form-control" autocomplete="off" required>
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 查看方式 个人中心=》密钥管理=>SK</span>
                            </div>
                        </div>
                        <div class="form-group parame parame_qiniu">
                            <label class="col-sm-2 control-label is-required">存储空间：</label>
                            <div class="col-sm-9">
                                <input type="text" name="qiniu[bucket]" value="<?=$info['qiniu']['bucket']??''?>" class="form-control" autocomplete="off" required>
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 查看方式 控制台=》对象存储=>空间管理</span>
                            </div>
                        </div>
                        <div class="form-group parame parame_qiniu">
                            <label class="col-sm-2 control-label is-required">域名：</label>
                            <div class="col-sm-9">
                                <input type="text" name="qiniu[domain]" value="<?=$info['qiniu']['domain']??''?>" class="form-control" autocomplete="off" required>
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 查看方式 控制台=》对象存储=>空间管理=>概览=>CDN加速域名</span>
                            </div>
                        </div>
                        <div class="form-group parame parame_aly">
                            <label class="col-sm-2 control-label is-required">accessKeyId：</label>
                            <div class="col-sm-9">
                                <input type="text" name="aly[accessKeyId]" value="<?=$info['aly']['accessKeyId']??''?>" class="form-control" autocomplete="off" required>
                            </div>
                        </div>
                        <div class="form-group parame parame_aly">
                            <label class="col-sm-2 control-label is-required">accessKeySecret：</label>
                            <div class="col-sm-9">
                                <input type="text" name="aly[accessKeySecret]" value="<?=$info['aly']['accessKeySecret']??''?>" class="form-control" autocomplete="off" required>
                            </div>
                        </div>
                        <div class="form-group parame parame_aly">
                            <label class="col-sm-2 control-label is-required">endpoint：</label>
                            <div class="col-sm-9">
                                <input type="text" name="aly[endpoint]" value="<?=$info['aly']['endpoint']??''?>" class="form-control" autocomplete="off" required>
                            </div>
                        </div>
                        <div class="form-group parame parame_aly">
                            <label class="col-sm-2 control-label is-required">bucket：</label>
                            <div class="col-sm-9">
                                <input type="text" name="aly[bucket]" value="<?=$info['aly']['bucket']??''?>" class="form-control" autocomplete="off" required>
                            </div>
                        </div>
                        <div class="form-group parame parame_txy">
                            <label class="col-sm-2 control-label is-required">secretId：</label>
                            <div class="col-sm-9">
                                <input type="text" name="txy[bucket]" value="<?=$info['txy']['secretId']??''?>" class="form-control" autocomplete="off" required>
                            </div>
                        </div>
                        <div class="form-group parame parame_txy">
                            <label class="col-sm-2 control-label is-required">secretKey：</label>
                            <div class="col-sm-9">
                                <input type="text" name="txy[secretKey]" value="<?=$info['txy']['secretKey']??''?>" class="form-control" autocomplete="off" required>
                            </div>
                        </div>
                        <div class="form-group parame parame_txy">
                            <label class="col-sm-2 control-label is-required">region：</label>
                            <div class="col-sm-9">
                                <input type="text" name="txy[region]" value="<?=$info['txy']['region']??''?>" class="form-control" autocomplete="off" required>
                            </div>
                        </div>
                        <div class="form-group parame parame_txy">
                            <label class="col-sm-2 control-label is-required">bucket：</label>
                            <div class="col-sm-9">
                                <input type="text" name="txy[bucket]" value="<?=$info['txy']['bucket']??''?>" class="form-control" autocomplete="off" required>
                            </div>
                        </div>
                        <div class="form-group parame parame_txy">
                            <label class="col-sm-2 control-label is-required">host：</label>
                            <div class="col-sm-9">
                                <input type="text" name="txy[host]" value="<?=$info['txy']['host']??''?>" class="form-control" autocomplete="off" required>
                            </div>
                        </div>
                        <div class="form-group text-center mt20">
                            <a href="javascript:;" class="btn btn-success btn-mid b5submit_btn"
                               data-target="form-config-site-site" data-title="确定提交设置" data-url="<?=\yii\helpers\Url::to(['upload-set'])?>">保存</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
<?php $this->beginBlock('script'); ?>
    <script>
        $('.parame').hide()
        var current_way = "<?=$info['current_way']?>"
        $('.parame_'+current_way).show()
        $('body').on('ifChecked','.radio-box input',function (event) {
            var value = $(this).val();
            $('.parame').hide()
            $('.parame_'+value).show()
        })
        function b5submit_btn_before() {
            var target=$('.b5submit_btn').attr("data-target");
            var url=$('.b5submit_btn').attr("data-url");
            var title=$('.b5submit_btn').attr("data-title");
            var data=$("#"+target).serialize();
            if ($.validate.form()) {
                if(title){
                    $.modal.confirm(title,function () {
                        $.operate.saveModal(url,data)
                    });
                }else{
                    $.operate.saveModal(url,data)
                }
            }
        }
    </script>
<?php $this->endBlock(); ?>